﻿using System;
using System.Threading;
using System.Threading.Tasks;
using System.Linq;

namespace WSU.ChekaParallel.TestTask
{
    static class TestSpeculativeExe
    {
        public static void SpeculativeInvoke(params Action<CancellationToken>[] actions)
        {
            CancellationTokenSource cancelSource = new CancellationTokenSource();
            CancellationToken cancelToken = cancelSource.Token;

            Task[] tasks = (from act in actions
                            select Task.Factory.StartNew(() => act(cancelToken), cancelToken)).ToArray();

            int finished = 0;
        }
    }
}
